package com.platform.modules.sys.controller;

import java.util.HashMap;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.platform.common.annotation.SysLog;
import com.platform.common.page.PageUtil;
import com.platform.common.utils.RestResponse;
import com.platform.common.enumstatus.SystemEnum;
import com.platform.modules.mail.service.MailService;
import com.platform.modules.sys.service.SysExamineStatusService;
import com.platform.modules.sys.service.SysOrgAptitudeService;
import com.platform.modules.sys.service.SysOrgService;
import com.platform.modules.sys.service.SysOrgUserService;
import com.platform.modules.sys.service.SysRoleService;
import com.platform.modules.sys.service.SysUserAptitudeService;
import com.platform.modules.sys.service.SysUserRoleService;
import com.platform.modules.sys.service.SysUserService;


@Api(tags = "AdminContoller|运维用户管理")
@RestController
@RequestMapping("admin")
public class AdminContoller extends AbstractController{
	
	@Autowired
	private SysOrgService sysOrgService;
	@Autowired
	private SysUserService sysUserService;
	/**
	 * 企业信息管理
	 */
	@ApiOperation(value = "企业信息管理", notes = "企业信息管理")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "orgName", value = "企业名称", dataType = "String"),
		@ApiImplicitParam(paramType = "query", name = "creditCode", value = "统一社会信用代码", dataType = "String"),
		@ApiImplicitParam(paramType = "query", name = "currPage", value = "当前页数", dataType = "Integer"),
		@ApiImplicitParam(paramType = "query", name = "limit", value = "分页步数", dataType = "Integer")
    })
	@SysLog("企业信息管理")
	@PostMapping("/orgList")
	public RestResponse orgList(String orgName,String creditCode,Integer currPage,Integer limit) {
		
		Map<String, Object> params = new HashMap<String, Object>();
			params.put("page", PageUtil.getCurrPage(currPage));
			params.put("limit", PageUtil.getLimit(limit));
			params.put("orgName", orgName);
			params.put("creditCode", creditCode);
			IPage page = sysOrgService.queryPage(params);
		return RestResponse.success().put("page", page);
	}
	
	/**
	 * 用户信息管理
	 */
	@ApiOperation(value = "用户信息管理", notes = "用户信息管理")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "userCard", value = "身份证号码", dataType = "String"),
		@ApiImplicitParam(paramType = "query", name = "currPage", value = "当前页数", dataType = "Integer"),
		@ApiImplicitParam(paramType = "query", name = "limit", value = "分页步数", dataType = "Integer")
    })
	@SysLog("用户信息管理")
	@PostMapping("/userList")
	public RestResponse userList(String userCard,Integer currPage,Integer limit) {
		
		Map<String, Object> params = new HashMap<String, Object>();
			params.put("page", PageUtil.getCurrPage(currPage));
			params.put("limit", PageUtil.getLimit(limit));
			params.put("userCard", userCard);
		Page page = sysUserService.queryPage(params);
		return RestResponse.success().put("page", page);
	}
	
	
//	/**
//	 * 资质人员查询
//	 */
//	@ApiOperation(value = "资质人员查询", notes = "资质人员查询")
//	@ApiImplicitParams({
//		@ApiImplicitParam(paramType = "query", name = "userCard", value = "身份证号码", dataType = "String"),
//		@ApiImplicitParam(paramType = "query", name = "currPage", value = "当前页数", dataType = "Integer"),
//		@ApiImplicitParam(paramType = "query", name = "limit", value = "分页步数", dataType = "Integer")
//    })
//	@SysLog("用户信息管理")
//	@PostMapping("/aptitudeUserList")
//	public RestResponse aptitudeUserList(String userCard,Integer currPage,Integer limit) {
//		
//		Map<String, Object> params = new HashMap<String, Object>();
//			params.put("page", PageUtil.getCurrPage(currPage));
//			params.put("limit", PageUtil.getLimit(limit));
//			params.put("roleCode", SystemEnum.roleType.ZZRY.getKey());
//			params.put("userCard", userCard);
////
////			sysUserAptitudeService.queryPage(params);
//		Page page = sysOrgUserService.queryPage(params);
//		return RestResponse.success().put("page", page);
//	}
	
	
}
